<template>
	<view>
		<view class="message-ul">
			<view class="message-li" v-for="item in dataList" @tap="goDetail(item.id)" :key="item.dataItemName">
				<view class="big-name">{{ item.dataItemName }}</view>
				<view class="flex-row-between"><span class="title">上报时间：</span><span>{{ item.createTime }}</span></view>
				<view class="flex-row-between"><span class="title">上报人：</span><span>{{ item.createUser }}</span></view>
				<view class="flex-row-between">
					<span class="title">上报类型：</span>
					<span v-if="item.dataItemType == 'text'">文本</span>
					<span v-if="item.dataItemType == 'number'">数值</span>
					<span v-if="item.dataItemType == 'pic'">图片</span>
					<span v-if="item.dataItemType == 'word'">文档</span>
					<span v-if="item.dataItemType == 'fwb'">富文本</span>
					<span v-if="item.dataItemType == 'link'">链接</span>
					<span v-if="item.dataItemType == 'video'">视频</span>
				</view>
				<view class="flex-row-between">
					<span class="title">上报来源：</span>
					<span v-if="item.dataItemSource == 'inside'">内部维护</span>
					<span v-if="item.dataItemSource == 'outside'">用户维护</span>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				tota: 0,
				pageIndex: 1,
			}
		},
		mounted() {
			this.getData();
		},
		methods: {
			getData() {
				let token = getApp().globalData.token;
				uni.request({
					url: getApp().globalData.url + '/blade-visual/dataitem/list',
					header: {
						'blade-auth': "bearer " + token
					},
					method: "get",
					data: {
						current: this.pageIndex,
						size: 10
					},
					success: (res) => {
						// console.log(res);
						let code = res.data.code;
						if(code == 200) {
							let data = res.data.data
							this.dataList = data.records;
							this.total = data.total;
						} else {
							uni.showToast({
								title: res.data.msg,
								duration: 2000,
								icon: 'none'
							})
						}
					}
				});
			},
			goDetail(id) {
				if(id && id != '') {
					uni.navigateTo({
						url: './reportDetail?id=' + id
					})
				}
			}
		}
	}
</script>

<style>
	.message-ul {
		box-sizing: border-box;
		width: 100%;
		font-size: 32rpx;
		padding: 0 24rpx;
	}
	
	.message-li {
		box-sizing: border-box;
		width: 100%;
		padding: 30rpx;
		border-radius: 10rpx;
		color: #333;
		background: #ffffff;
		margin-top: 20rpx;
		line-height: 54rpx;
		font-size: 28rpx;
	}
	
	.message-li .big-name {
		line-height: 64rpx;
		font-size: 36rpx;
		font-weight: 600;
	}
	
	.message-li .title {
		color: #999;
	}
	
</style>
